<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>时钟</title>
    <style>
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: #000;
        margin: 0;
        font-family: Arial, sans-serif;
      }

      .clock-container {
        text-align: center;
      }

      .clock {
        font-size: 2rem;
        font-weight: bold;
        color: #fff;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        box-shadow: 4px 4px 15px red;
      }
    </style>
  </head>
  <body>
    <div class="clock-container">
      <div style="color: #fff; font-size: 40px; margin-bottom: 20px">时钟</div>
      <div id="clock" class="clock"></div>
    </div>

    <script>
      document.addEventListener("DOMContentLoaded", function () {
        function updateClock() {
          const now = new Date();
          const hours = String(now.getHours()).padStart(2, "0");
          const minutes = String(now.getMinutes()).padStart(2, "0");
          const seconds = String(now.getSeconds()).padStart(2, "0");

          const timeString = `${hours}:${minutes}:${seconds}`;
          document.getElementById("clock").textContent = timeString;
        }

        updateClock();
        setInterval(updateClock, 1000);
      });
    </script>
  </body>
</html>
